package com.ruoyi.develop.factory.factoryPurchaseMainColumn.service.impl;

import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
        import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ruoyi.develop.factory.factoryPurchaseMainColumn.mapper.FactoryPurchaseMainColumnMapper;
import com.ruoyi.develop.factory.factoryPurchaseMainColumn.domain.FactoryPurchaseMainColumn;
import com.ruoyi.develop.factory.factoryPurchaseMainColumn.service.IFactoryPurchaseMainColumnService;

/**
 * 采购订单行项目信息Service业务层处理
 * @author qh
 * @date 2024-11-08
 */
@Service
public class FactoryPurchaseMainColumnServiceImpl implements IFactoryPurchaseMainColumnService {
    @Resource
    private FactoryPurchaseMainColumnMapper factoryPurchaseMainColumnMapper;

    /**
     * 查询采购订单行项目信息
     * @param id 采购订单行项目信息主键
     * @return 采购订单行项目信息
     */
    @Override
    public FactoryPurchaseMainColumn selectById(String id) {
        return factoryPurchaseMainColumnMapper.selectById(id);
    }

    /**
     * 查询采购订单行项目信息列表
     * @param entity 采购订单行项目信息
     * @return 采购订单行项目信息
     */
    @Override
    public List<FactoryPurchaseMainColumn> selectList(FactoryPurchaseMainColumn entity) {
        return factoryPurchaseMainColumnMapper.selectList(entity);
    }

    /**
     * 新增采购订单行项目信息
     * @param entity 采购订单行项目信息
     * @return 结果
     */
    @Override
    public int insert(FactoryPurchaseMainColumn entity) {
        if(StringUtils.isBlank(entity.getId())){
            entity.setId(IdUtils.fastSimpleUUID());
        }
                entity.setCreateBy(SecurityUtils.getUsername());
                entity.setCreateTime(DateUtils.getNowDate());
            return factoryPurchaseMainColumnMapper.insert(entity);
    }

    /**
     * 修改采购订单行项目信息
     * @param entity 采购订单行项目信息
     * @return 结果
     */
    @Override
    public int update(FactoryPurchaseMainColumn entity) {
                entity.setUpdateBy(SecurityUtils.getUsername());
                entity.setUpdateTime(DateUtils.getNowDate());
        return factoryPurchaseMainColumnMapper.update(entity);
    }

    /**
     * 批量删除采购订单行项目信息
     * @param ids 需要删除的采购订单行项目信息主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return factoryPurchaseMainColumnMapper.deleteByIds(ids);
    }

    /**
     * 删除采购订单行项目信息信息
     * @param id 采购订单行项目信息主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return factoryPurchaseMainColumnMapper.deleteById(id);
    }
}
